FILE(GLOB PB_FILES *.proto)
SET(SOURCE_PROTOCAL)
FOREACH(pbfile ${PB_FILES})
  STRING(REGEX REPLACE "(.*).proto$" "\\1.pb.cc" GEN_CC ${pbfile})
  ADD_CUSTOM_COMMAND(
    OUTPUT ${GEN_CC}
    COMMAND protoc -I${CMAKE_SOURCE_DIR}/base --cpp_out=${CMAKE_SOURCE_DIR}/base ${pbfile}
    DEPENDS ${pbfile}
    )
  SET(SOURCE_PROTOCAL ${SOURCE_PROTOCAL} ${GEN_CC})
ENDFOREACH()


#AUX_SOURCE_DIRECTORY(. MAINGROUP)
FILE(GLOB CPP_FILES *.cpp)
SET(SOURCE_MESSAGE ${CPP_FILES})
SET(SOURCE_MESSAGE ${SOURCE_MESSAGE} ${SOURCE_PROTOCAL})
ADD_LIBRARY(base STATIC ${SOURCE_MESSAGE})
